#ifndef SMARTHOME_H
#define SMARTHOME_H

#include <QWidget>
#include <QSerialPort>
#include <qcustomplot.h>
#include <QNetworkAccessManager>
#include <QtMqtt/qmqttclient.h>

QT_BEGIN_NAMESPACE
namespace Ui { class smartHOme; }
QT_END_NAMESPACE

class smartHOme : public QWidget
{
    Q_OBJECT

public:
    smartHOme(QWidget *parent = nullptr);
    ~smartHOme();
    void SimpleDemo(QCustomPlot *customPlot,double tempnum[10],double n);
protected:
    QSerialPort *pSerialPort;
    QMqttClient *pMqttClient;
    QNetworkAccessManager *pNetworkAccessManager;
    //QCustomPlot *customPlot;
    int start=0;
    double tempnum[23];
    double times[23];
    QString time ;
    QByteArray buf;
private slots:
    void receive_data();

    void on_lightButton_clicked();

    void on_fanButton_2_clicked();

    void connected_isr();
    void onTimeOut();

    void recv_message(QByteArray message);

    void SimpleDemo();

    void change_chart();

    qint32 getWebTime();

    void request_Finished(QNetworkReply *reply);

private:
    Ui::smartHOme *ui;
};
#endif // SMARTHOME_H
